package cn.wolfcode.crm.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;


import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class CustomerTransfer extends BaseDomain{

    private Customer customer;

    private Employee operator;

    private Date operateTime;

    private Employee oldSeller;

    private Employee newSeller;

    private String reason;



    public String getJsonString(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("customerName",customer.getName());
        map.put("customerId",customer.getId());
        map.put("operatorName",operator.getName());
        map.put("operatorId",operator.getId());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        map.put("operateTime",sdf.format(operateTime));
        map.put("oldSellerName",oldSeller.getName());
        map.put("oldSellerId",oldSeller.getId());
        map.put("newSellerName",newSeller.getName());
        map.put("newSellerId",newSeller.getId());
        map.put("reason",reason);
        return JSON.toJSONString(map);
    }
}